<div ng-controller="postageEditCtrl">
    <div class="bg-light lter b-b wrapper-md ng-scope">
        <h4 class="m-n font-thin">运费管理</h4>
        <button onClick="javascript:history.go(-1)" class="btn-back btn btn-dark btn-sm btn-rounded">
            返回
        </button>
    </div>
    <div class="wrapper-md">
        <div class="panel-body panel">
            <span class="m-b block"><p class="inline m-n font-bold">运费模板</p>-新建运费模板</span>
            <form name="postForm">
                <div class="form-horizontal form-validation">
                    <div class="panel-body bg-light">
                        <div class="m-b-sm">
                            <div class="form-group">
                                <label class="col-sm-2 text-right control-label">模板名称</label>
                                <div class="col-sm-10">
                                    <input type="text" class="form-control w-xxl" placeholder="模板名称" ng-model="postageTemplateJson.name" required="">
                                </div>
                            </div>
                            <div class="form-group">
                                <label class="col-sm-2 text-right control-label">模板类型</label>
                                <div class="col-sm-10">
                                    <div class="inline m-r-xs">
                                        <div class="radio inline m-r-n">
                                            <label class="i-checks i-checks-sm">
                                                <input type="radio" name="valuateType" ng-model="postageTemplateJson.valuateType" value="0">
                                                <i></i>
                                            </label>
                                        </div>
                                        <p class="font-bold inline m-n">按重量</p>
                                        <i class="inline m-l-xs fa fa-question-circle text-muted pos-rlt h6" popover-placement="top" popover="按重量" popover-trigger="mouseenter"></i>
                                    </div>
                                </div>
                            </div>
                            <div class="form-group m-b">
                                <label class="col-sm-2 text-right control-label">配送区域及运费</label>
                                <div class="col-sm-8">
                                    <div class="panel-body panel m-b-sm b-a">
                                        <table class="table table-bordered fa-border">
                                            <thead>
                                                <tr>
                                                    <th>可配送区域</th>
                                                    <th>首重（kg）</th>
                                                    <th>运费(元)</th>
                                                    <th>续重（个）</th>
                                                    <th>续费(kg)</th>
                                                </tr>
                                            </thead>
                                            <tbody>
                                                <tr ng-repeat="item in postageConditionJson track by $index">
                                                    <td>
                                                        <div class="text-left">
                                                            <div class="inline w-md">
                                                                <span class="h6">
                                                                    <p class="h6 text-muted m-b-xs" ng-if="item.areaContent==null">请选择可配送区域{{item.areaJson}}</p>
                                                                    <p class="h6 text-muted l-h" ng-if="item.areaContent!=''">{{item.areaContent}}</p>
                                                                </span>
                                                            </div>
                                                            <div class="inline">
                                                                <a class="h6 text-success" ng-click="openPoups(item)">编辑</a>
                                                                <a class="h6 text-success" ng-click="deleteArea($index,item)">删除</a>
                                                            </div>
                                                        </div>
                                                    </td>
                                                    <td>
                                                        <input type="text" class="form-control" name="basicQuality" ng-model="item.basicQuality" ng-pattern="/^([1-9][\d]*|0)$/" required>
                                                    </td>
                                                    <td>
                                                        <input type="text" class="form-control" name="basicPostage" ng-model="item.basicPostage" ng-pattern="/^([1-9][\d]*|0)(\.[\d]{1,2})?$/" required>
                                                    </td>
                                                    <td>
                                                        <input type="text" class="form-control" name="incrementQuality" ng-model="item.incrementQuality" ng-pattern="/^([1-9][\d]*|0)$/" required>
                                                    </td>
                                                    <td>
                                                        <input type="text" class="form-control" name="incrementPostage" ng-model="item.incrementPostage" ng-pattern="/^([1-9][\d]*|0)(\.[\d]{1,2})?$/" required>
                                                    </td>
                                                </tr>
                                            </tbody>
                                            <tfoot>
                                                <tr>
                                                    <td colspan="5">
                                                        <div class="btn btn-default btn-sm m-n" ng-click="addArea()"><i class="icon-pointer"></i>点击添加可配送区域和运费</div>
                                                    </td>
                                                </tr>
                                            </tfoot>
                                        </table>
                                    </div>
                                    <div>
                                        <div class="h6"><span class="inline">新添加的商品支持在线运费模板选择,根据情况配置合理模板</span></div>
                                    </div>
                                </div>
                            </div>
                        </div>
                        <div class="text-center">
                            <button class="btn btn-success btn-sm" ng-click="edit()" ng-disabled="postForm.$invalid">保存</button>
                        </div>
                    </div>
                </div>
            </form>
        </div>

    </div>
</div>